import Vue from 'vue';
import Router from 'vue-router';

Vue.use(Router);

export default new Router({
    routes: [
        {
            path: '/',
            meta: { requiresAuth: true },
            component: resolve => require.ensure([], () => resolve(require('../components/common/Home.vue')), 'chunkname1'),
            children:[
                {
                    path: '/',
                    component: resolve => require.ensure([], () => resolve(require('../components/page/Index.vue')), 'chunkname2')
                    // vue-schart组件
                },
                {
                    path: '/base',
                    component: resolve => require.ensure([], () => resolve(require('../components/page/baseForm.vue')), 'chunkname2')
                    // vue-schart组件
                },
                {
                    path: '/userList',
                    component: resolve => require.ensure([], () => resolve(require('../components/page/userList.vue')), 'chunkname2')
                    // vue-schart组件
                },
                {
                    path: '/add',
                    component: resolve => require.ensure([], () => resolve(require('../components/page/addProduct.vue')), 'chunkname2')
                    // vue-schart组件
                }
            ]
        },
        {
            path: '/login',
            component: resolve => require.ensure([], () => resolve(require('../components/page/Login.vue')), 'chunkname1')
        }
    ]
});
